<?php

namespace App\Jobs;

use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;

class DingtalkException extends Job
{
    const QUEUE_NAME = '{default}';
    private $data = null;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($data)
    {
        //
        $this->data = $data;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $url  = config('blogConfig.ding_robot');
        $data = [
            'msgtype'   => 'text',
            'text'      => array ('content' => $this->data),
            'at'        => [
                'isAtAll'=>true,
                'atUserIds'=>'yintianyudd',
                'atMobiles'=>'13263382838'
            ]
        ];
        $res = Http::post($url,$data);
        Log::info(json_encode($res,256));
    }
}
